package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

func GetBookDetialHandler(c *gin.Context) {
	bookId := c.Param("id")
	// gin.Context，封装了request和response
	c.String(http.StatusOK, fmt.Sprintf("成功获取书籍详情：%s", bookId))

}

func main() {
	//创建路由
	r := gin.Default()

	//2.绑定路由规则，执行函数
	r.GET("/book/:id", GetBookDetialHandler)

	//3.监听端口
	r.Run()

}
